﻿import requests;
import json;
import re;

class fc():

	def getfc(self):

		r=requests.get(url='https://www.jcfun.net/',headers={'Cookie':'PHPSESSID=sdvgtfrjf8hgh5akgbd2b4oso4; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_b8691fdf755ea304747438e9bbbdbdb4=zhaohuaishuai%7C1597194051%7CTdjbTu8RBUL1XO8dQP3lGNS3Z2r3wmwmh7ZaUlRNtg5%7C7f190dfda289c64659698f6ca67452d4805a1900d1c5d7f5af38e467445c93ba'})

		

		jcHtml=r.text

		f=open('jsHtml.txt','w+')

		f.write(jcHtml)

		f.close()

		

		jcg=re.finditer(r'<audio controls src="https://image.jcfun.net/jcfun-.+mp3|k">[0-9一-龢]+(?=<)',jcHtml)

		#'https://image.jcfun.net/jcfun-[a-zA-Z0-9]+.jpg'

		ob=[]

		i=0

		for match in jcg: 

			

			# ob.append({})

			txt=match.group()

			# ti=re.search(r'<audio controls src="',txt)

			# tii=re.search(r'k">',txt)

			# if ti :

			# 	txt=re.sub(r'<audio controls src="|k">','',txt)

			# 	ob[i]['audioUrl']=txt

			# if tii :

			# 	txt=re.sub(r'<audio controls src="|k">','',txt)

			# 	ob[i]['title']=txt


			txt=re.sub(r'<audio controls src="|k">','',txt)

			ob.append(txt)

			i=i+1


		print(ob)

		f=open('C:/phpstudy_pro/WWW/cscs.qumei.com/appApi/jsHtml.json','w+')

		f.write(json.dumps(ob))

		f.close()


	def getImg(self):

		r=requests.get(url='')#https://www.aitaotu.com/guonei/57855_4.html

		

		html=r.text

		

		jcg=re.finditer(r'<img>.+\.jpg',html)

		

		for match in jcg: 

			print(match)


		f=open('imgHtml.txt','w+',encoding='utf-8')

		f.write(html)

		f.close()



		
		


		



if __name__ == '__main__':

	fci=fc()

	fci.getImg()